<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@taglib uri="/billing" prefix="b"%>
<%@page import="com.admin.service.ProvinceService"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>计费后台管理</title>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/managercss.css">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/wbox.css">
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery-1.4.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery.form.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/wbox.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/validate.js"></script>
<script language="javascript" src="<%=request.getContextPath() %>/PopupCalendar/popup.js"></script>
<script type="text/javascript">
<!--
	$(function(){
		$(".list div").mousemove(function(){
			$(this).css("background","#E3EEFF");
		}).mouseout(function(){
			$(this).css("background","");
		});
		$("#provinceId").val('${provinceId}');
		$("#isp").val('${isp}');
		$("#vodCustomized").val('${vodCustomized}');
	});

	function del(spId){
		if(confirm("你确认删除该SP吗?")){
			$.ajax({
				url:"<%=request.getContextPath() %>/admin/sp/del/"+spId,
				type:"GET",
				success:function(flag){
					if(flag=='1'){
						alert("删除成功!");
						window.location.reload();
					}else{
						alert("删除失败!");
					}
				}
			});
		}
	}
	function addSp(){
		var wBox = $("#ajax").wBox({
			requestType: "iframe",
			iframeWH:{width:700,height:600},
			target:"<%=request.getContextPath() %>/admin/sp/toadd",
			title: "添加新的SP"
		});
		wBox.showBox();
	}

	function fenpei(spid){
		var wBox = $("#ajax").wBox({
			requestType: "iframe",
			iframeWH:{width:700,height:600},
			target:"<%=request.getContextPath() %>/admin/sp/tofenpei/"+spid,
			title: "分配SP通道"
		});
		wBox.showBox();
	}

	function show(spId){
		var wBox = $("#ajax").wBox({
			requestType: "iframe",
			iframeWH:{width:700,height:600},
			target:"<%=request.getContextPath() %>/admin/sp/"+spId,
			title: "查看SP"
		});
		wBox.showBox();
	}

	function changeCompany(companyId) {
		$.ajax({
			url:"<%=request.getContextPath() %>/admin/sp/selectSp?companyId="+companyId,
			type:"GET",
			success:function(result){
				$("#spId").html(result);
			}
		});
	}
//-->
</script>
</head>
<body>
<div class="information">
	<div class="title">
		SP列表
	</div>
	<div class="search">
		<form action="<%=request.getContextPath() %>/admin/sp/hourStatList" method="post">
		<input name="txtDateStart" type="text" readonly="readonly" value="选择日期" id="txtDate" OnClick="calendar()" />
		<c:set value="${companyList}" var="companyList"></c:set>
		SP合作商
		<select name="companyId" id="companyId" style="width: 120px;" onchange="changeCompany(this.value)">
			<option value="0">请选择</option>
			<c:forEach items="${companyList}" var="p">
				<option value="${p.companyId }">${p.companyName }</option>
			</c:forEach>
		</select>
		SP通道
		<select name="spId" id="spId" style="width: 120px;">
			<option value="0">请选择</option>
		</select>
		<c:set value="${cpList}" var="cpList"></c:set>
		CP合作商
		<select name="cpId" id="cpId" style="width: 120px;">
			<option value="0">请选择</option>
			<c:forEach items="${cpList}" var="p">
				<option value="${p.id }">${p.cpname }</option>
			</c:forEach>
		</select>
		省份
		<select name="provinceId" id="provinceId" style="width: 120px;">
			<option value="0">请选择</option>
			<c:forEach items="${provinceList}" var="p">
				<option value="${p.id }">${p.province }</option>
			</c:forEach>
		</select>
		<input type="submit" value="查询">
		</form>
	</div>
	<!--
	<div class="listTitle">
		<ul>
			<li style="width:100px;">时间</li>		
			<li style="width:40px;">渠道号</li>		
			<li style="width:60px;">合作商</li>
			<li style="width:80px;">sp通道</li>		
			<li style="width:80px;">sp指令</li>		
			<li style="width:60px;">运营商</li>		
			<li style="width:40px;">省份</li>
			<li style="width:50px;">上行</li>
			<li style="width:50px;">下行</li>
			<li style="width:60px;">成功下行</li>
			<li style="width:60px;">信息费</li>
			<li style="width:50px;">cp上行</li>
			<li style="width:50px;">cp下行</li>
			<li style="width:80px;">cp成功下行</li>
			<li style="width:60px;">cp信息费</li>
		</ul>
	</div>
	<div class="list">
		<c:forEach items="${pageBean.result}" var="sp" varStatus="status">
			<div class="${status.index%2==0?'noselect':'select' }">
				<ul>
					<li style="width:100px;">${sp.dt }</li>
					<li style="width:40px;">${sp.cpid }</li>
					<li style="width:60px;">${sp.cpname }</li>
					<li style="width:80px;">${sp.spcode }</li>	
					<li style="width:80px;">${sp.spcommand }</li>	
					<li style="width:60px;">${sp.isp==1?'移动':'联通' }</li>	
					<li style="width:40px;">${sp.cityname }</li>		
					<li style="width:50px;">${sp.mo }</li>
					<li style="width:50px;">${sp.mt }</li>
					<li style="width:60px;">${sp.statmt }</li>
					<li style="width:60px;">${sp.statfee/100 }</li>
					<li style="width:50px;">${sp.cpMo }</li>
					<li style="width:50px;">${sp.cpMt }</li>
					<li style="width:80px;">${sp.cpStatmt }</li>
					<li style="width:60px;">${sp.cpStatfee/100 }</li>
				</ul>
				<div class="clear"></div>
			</div>
		</c:forEach>
	</div>
	-->
	
	
	<table align="center">
		<tr class="list" align="center">
		<td width="100">时间</td>
		<td width="100">cp合作商</td>
		<td width="100">sp通道</td>
		<td width="100">sp指令</td>
		<td width="100">运营商</td>
		<td width="100">省份</td>
		<td width="100">用户数</td>
		<td width="100">上行</td>
		<td width="100">下行</td>
		<td width="100">成功下行</td>
		<td width="100">信息费</td>
		<td width="100">cp用户数</td>
		<td width="100">cp上行</td>
		<td width="100">cp下行</td>
		<td width="100">cp成功下行</td>
		<td width="100">cp信息费</td>
		</tr>
	
	
		<c:forEach items="${pageBean.result}" var="sp" varStatus="status">
		
			<tr class="${status.index%2==0?'noselect':'select' }" align="center">
				<td>${sp.dt }</td>
				<td>${sp.cpname }</td>
				<td>${sp.spcode }</td>
				<td>${sp.spcommand }</td>
				<td>${sp.isp==1?'移动':'联通' }</td>
				<td>${sp.cityname }</td>
				<td>${sp.moUser }</td>
				<td>${sp.mo }</td>
				<td>${sp.mt }</td>
				<td>${sp.statmt }</td>
				<td>${sp.statfee/100 }</td>
				<td>${sp.cpMoUser }</td>
				<td>${sp.cpMo }</td>
				<td>${sp.cpMt }</td>
				<td>${sp.cpStatmt }</td>
				<td>${sp.cpStatfee/100 }</td>
			</tr>
		
		</c:forEach>
	</table>
	
	<jsp:include page="../page.jsp" flush="true"></jsp:include>
	<div class="search" align="center">
	<div class="list">
		<div class="select">
				<ul>
					<li style="width:80px;">上行总数：</li>
					<li style="width:80px;">${all.mo }</li>
					<li style="width:80px;">下行总数：</li>	
					<li style="width:80px;">${all.mt }</li>	
					<li style="width:120px;">成功下行总数：</li>	
					<li style="width:60px;">${all.statmt }</li>		
					<li style="width:80px;">总信息费：</li>
					<li style="width:60px;">${all.statfee/100 }</li>
				</ul>
				<div class="clear"></div>
				<ul>
						<li style="width:80px;">cp上行总数：</li>
						<li style="width:80px;">${all.cpMo }</li>
						<li style="width:80px;">cp下行总数：</li>	
						<li style="width:80px;">${all.cpMt }</li>	
						<li style="width:120px;">cp成功下行总数：</li>	
						<li style="width:60px;">${all.cpStatmt }</li>		
						<li style="width:80px;">cp总信息费：</li>
						<li style="width:60px;">${all.cpStatfee/100 }</li>
					</ul>
					<div class="clear"></div>
			</div>
			</div>
	</div>
</div>
</body>
</html>